import {
  REDIRECT_PAGE,
  LIST_DATA,
  LIST_DATA_LV,
} from '../../constants/actionTypes';

export function redirect(state = { direction: 'left', tabHide: false }, action) {
  switch (action.type) {
    case REDIRECT_PAGE: {
      return {
        direction: action.redirect.direction,
        tabHide: action.redirect.tabHide
      }
    }
    default:
      return state;
  }
}

export function lists(state = {data:{
  num: 0,
  items: []
}, offsetTop: 0}, action) {
  switch (action.type) {
    case LIST_DATA: {
      return {
        ...state,
        data: action.data
      }
    }
    case LIST_DATA_LV: {
      return {
        ...state,
        offsetTop: action.offsetTop
      }
    }
    default:
      return state;
  }
}
